<?php

namespace App\Controllers\Lessions;

use App\Models\Lession\Lession;
use App\Models\Lession\CommentCopy;
use App\Models\Tag\Tags;
/**
    //获取热搜词语
 */
class GetHotSearch extends \App\Libs\Base\BaseAction
{

    public function execute()
    {
        $allTags = Tags::findAll([
            'conditions' => 'tag_type=7'
        ]);
        $finalData = [];
        $allTags->rewind();
        if($allTags->valid()){
            while($allTags->valid()){
                $current = $allTags->current();
                $data = json_decode($current->data,true);
                if(isset($data['isshow'])){
                    if(!empty($data['isshow'])){
                        $finalData[] = $current->tag_name;
                    }
                }
                $allTags->next();
            }
        }

        return \App\Libs\Views\Json::view(0, '成功', $finalData);
    }
}
